import React from 'react';
import 'antd/dist/antd.css';
import './new_file.css'
import logo from '../../img4/logo.png'
import Item from 'antd/lib/list/Item';
import $ from 'jquery';
import '../../config'
import {
  BrowserRouter,
  HashRouter,
  Route,
  Link
} from 'react-router-dom';

import cartMehtod from '../../publicMethod.js'

class A extends React.Component {
	constructor(props) {
		super(props);
		this.state = {
			list: [
				{
					top: 'A', city: ['安阳', '安康', '安庆', '鞍山', '安顺', '安阳']
				},
				{
					top: 'B', city: ['北京', '白城','白山','白银','蚌埠','保定','宝鸡','保山','巴中','北海','本溪','滨州','博乐','亳州']
				},
				{
					top: 'C', city: ['重庆','成都','长沙','长春','常熟','郴州','常州','滁州','巢湖','池州','常德','潮州','昌吉']
				},
				{
					top: 'D', city: ['大庆','大连','达州','大港区','当阳','丹东','丹阳','东莞','德阳','丹江口','大理','定西','定州','大同']
				},
				{
					top: 'F', city: ['福建','佛山','福州']
				},
				{
					top: 'G', city: ['重庆','成都','长沙','长春','常熟','郴州','常州','滁州','巢湖','池州','常德','潮州','昌吉']
				},
				{
					top: 'H', city: ['重庆','成都','长沙','长春','常熟','郴州','常州','滁州','巢湖','池州','常德','潮州','昌吉']
				},
				{
					top: 'J', city: ['重庆','成都','长沙','长春','常熟','郴州','常州','滁州','巢湖','池州','常德','潮州','昌吉']
				},
				{
					top: 'K', city: ['重庆','成都','长沙','长春','常熟','郴州','常州','滁州','巢湖','池州','常德','潮州','昌吉']
				},
				{
					top: 'L', city: ['重庆','成都','长沙','长春','常熟','郴州','常州','滁州','巢湖','池州','常德','潮州','昌吉']
				},
				{
					top: 'N', city: ['重庆','成都','长沙','长春','常熟','郴州','常州','滁州','巢湖','池州','常德','潮州','昌吉']
				},
				{
					top: 'P', city: ['重庆','成都','长沙','长春','常熟','郴州','常州','滁州','巢湖','池州','常德','潮州','昌吉']
				},
				{
					top: 'Q', city: ['重庆','成都','长沙','长春','常熟','郴州','常州','滁州','巢湖','池州','常德','潮州','昌吉']
				},
				{
					top: 'S', city: ['重庆','成都','长沙','长春','常熟','郴州','常州','滁州','巢湖','池州','常德','潮州','昌吉']
				},
				{
					top: 'T', city: ['重庆','成都','长沙','长春','常熟','郴州','常州','滁州','巢湖','池州','常德','潮州','昌吉']
				},
				{
					top: 'W', city: ['重庆','成都','长沙','长春','常熟','郴州','常州','滁州','巢湖','池州','常德','潮州','昌吉']
				},
				{
					top: 'X', city: ['重庆','成都','长沙','长春','常熟','郴州','常州','滁州','巢湖','池州','常德','潮州','昌吉']
				},
				{
					top: 'Y', city: ['重庆','成都','长沙','长春','常熟','郴州','常州','滁州','巢湖','池州','常德','潮州','昌吉']
				},
				{
					top: 'Z', city: ['重庆','成都','长沙','长春','常熟','郴州','常州','滁州','巢湖','池州','常德','潮州','昌吉']
				},
			],
			selectcity:global.action.city
		}
	}
	city(e) {
		this.setState({
			selectcity :e.target.innerText,
		});
		cartMehtod.city = e.target.innerText;
		console.log(e.target.innerHTML);
		$('.citylist').addClass('cang');
		$('.tubiao').addClass('cang');
		e.preventDefault();
	}
		
	xianshi(){
		$('.citylist').removeClass('cang');
		$('.tubiao').removeClass('cang');
	}
	shouye() {
		this.props.history.push('/home');
	}
	render() {
		
		return (<div>
			<div className="contain">
				<div className="center1">
					<Link to="/jingxuan"  target='_self'>欢迎光临易和生活港</Link><div className="line"></div><Link to="/login"  target='_self'>我是商家</Link><div className="line"></div><span>400-100-0907</span>
				</div>
			</div>
			<div className="denglu">
				<div className="logo">
					<img src={logo} alt="" />
					<div className="deng">
						<Link to="/loginmima"  target='_self'>登录</Link><div className="line1"></div><Link to="/register"  target='_self'>注册</Link>
					</div>
				</div>
			</div>
			<div className="contr">
				<p>易和生活，纵享品质</p>
				<div className="select">
					<div className="inp">
						<input type="text" onClick={this.xianshi} placeholder="请选择你所在的城市" />
						<div className="citys">{cartMehtod.city}</div>
					</div>
					<button onClick={this.shouye.bind(this)}>进入易和</button>
				</div>
				<div className="tubiao cang">
					<i className="icon"></i>
				</div>
				<div className="citylist cang">
					<div className="hotcity1"><span>热门城市：</span><Link to="###"  target='_self'>北京</Link><Link to="###"  target='_self'>深圳</Link></div>
					<ul className="groupcity">{this.state.list.map((item, i) => {
						return (
							<li key={i}>
								<span>{item.top}</span>
								<div className="cityarea">
								{
									item.city.map((t,ii) => {
										return (
											<Link to="###" key={ii} onClick={this.city.bind(this)}>{t}</Link>
										)
									})
								}
								</div>
							</li>
						)})
					}</ul>
				</div>
			</div>
			<div className="bottom">
				<p>版权所有 © 2016易和生活港  保留所有权利 | 沪ICP备12042163</p>
				<p>易和生活  纵享品质</p>
			</div>
		</div>)
	}
}
export default A;